package com.xkcoding.upload.controller;

import com.xkcoding.upload.service.DownloadService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

@RestController
@Slf4j
@RequestMapping("/download")
public class DownloadController {

    @Resource
    DownloadService downloadService;

    @GetMapping(value = "/local")
    public void download(HttpServletResponse response) throws IOException {

        List<String> queryAll = new ArrayList<>();
        //模拟数据
        queryAll.add("测试数据");

        downloadService.download(queryAll, response);
    }


}
